package org.example.userToContentEnum;

/**
 * @FileName VisibilityEnum
 * @Description 用户显示范围的枚举类
 * @Author coderfun
 * @selfDesc coding in fun
 * @date 2024-11-27
 **/
public enum VisibilityEnum {
    PRIVATE(0),          // 私密
    FRIENDS_VISIBLE(1),  // 好友可见
    FANS_VISIBLE(2),     // 粉丝可见
    ALL_VISIBLE(3);      // 所有人可见

    private final int value;

    VisibilityEnum(int value) {
        this.value = value;
    }

    public int getValue() {
        return value;
    }

    public static VisibilityEnum fromValue(int value) {
        for (VisibilityEnum visibility : values()) {
            if (visibility.getValue() == value) {
                return visibility;
            }
        }
        throw new IllegalArgumentException("Invalid visibility value: " + value);
    }
}
